package com.atguigu.lease.common.utils;

import java.util.Random;

/**
 * @author 李俊伟
 * @date 2024/12/26 13:53
 */
public class VerifyCodeUtil {
    public static String getVerifyCode(int length) {
        StringBuilder stringBuilder = new StringBuilder();
        for (int i = 0; i < length; i++) {
            int code = new Random().nextInt(10);
            stringBuilder.append(code);
        }

        System.out.println("手机验证码：" + stringBuilder.toString());
        return stringBuilder.toString();
    }

    // 测试
//    public static void main(String[] args) {
//        getVerifyCode(6);
//    }
}